This page shows some example plotly plots

# Load and clean dataset

set.seed(1)

nyc_rest = 
  rest_inspec %>% 
  select(boro, camis, critical_flag, cuisine_description, score, grade) %>%
  sample_n(5000)

Column

NYC Restaurant Inspection Barplot

common_cuisine =
  nyc_rest %>% 
  count(cuisine_description, sort = TRUE) %>% 
  top_n(10) %>% 
  select(cuisine_description)

inner_join(nyc_rest, common_cuisine,
             by = "cuisine_description") %>% 
  filter(!is.na(grade)) %>% 
  group_by(cuisine_description, grade) %>% 
  summarize(n = n()) %>% 
  plot_ly(x = ~cuisine_description, y = ~n, type = 'bar', color = ~grade) %>% 
  layout(yaxis = list(title = 'Count'), 
         xaxis = list(title = 'Cuisine Type'), 
         barmode = 'stack')

Column

NYC Restaurant Inspection Boxplot

boxplot = nyc_rest %>% 
  mutate(boro = fct_reorder(boro, score)) %>% 
  plot_ly(y = ~score, color = ~boro, type = "box",
          colors = "Set2")